/**
 * 
 */
package advancedStreams;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.regex.Pattern;

/**
 * @author Student
 *
 */
public class TelephoneNumberReader {
	
	private File inputFile;
	private String pattern = "[0-9]{1,3}";
	
	public TelephoneNumberReader(String filename) {
		inputFile = new File(filename);
	}
	
	public void showAllNumbers() {
		try {
			Scanner input = new Scanner(inputFile);
			System.out.println("File open!");
			input.useDelimiter("x");
			while(input.hasNext()) {
				String number = input.next(pattern);
				System.out.printf("Telephone number: %s", number);
			}
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
